\subsection{Physical access layer}
\label{sec:bus:design:layer1}
The physical layer in the ``NES2011'' configuration is provided by a one-wire-USART terminated with a pull-down resistor, 
leading us to the fact, of a dominant 0 and an recessive 1 level.\\

Since this must not be true for all possible configurations supported by the protocol this leads
us to the first physical layer description. To accomplish support for other configurations the physical 
layer provided here has to be adjusted or completely exchanged by specific implementations.\\


\begin{figure}[h]
 \label{fig:bus:design:layer1:usartconfig}

\begin{center}


\definecolor{bgblue}{rgb}{0.41961,0.80784,0.80784}%
\definecolor{bgred}{rgb}{1,0.61569,0.61569}%
\definecolor{fgblue}{rgb}{0,0,0.6}%
\definecolor{fgred}{rgb}{0.6,0,0}%
%
\begin{tikztimingtable}[
    %timing/slope=0,         % no slope
    timing/coldist=2pt,     % column distance
    timing/lslope=0.1,
    xscale=2.05,yscale=2., % scale diagrams
    semithick               % set line width
  ]
  \scriptsize timing  	& 11{C}                              \\
  \scriptsize data                     & .5H L{S} 8D{8Bit} H       \\
  %R                     & [fgblue]  UH .8U 1.4H 0.8L \\
  %MISO & D{z} 2D{z} \\
  %Q                     &          L .8H 1.7L 1.5H LL       \\
  %$\overline{\mbox{Q}}$ &          H .8L 1.7H 1.5L HH       \\
  %Q                     & [fgred]  HLHHHLL                  \\
  %$\overline{\mbox{Q}}$ & [fgred]  LHLLLHH                  \\
\extracode
 \makeatletter
  \begin{pgfonlayer}{background}
%   % Draw shaded backgrounds
%   \shade [right color=bgblue,left color=white]
%      (7,-8.45) rectangle (-2,-4.6);
%   \shade [right color=bgred,left color=white]
%      (7,-12.8) rectangle (-2,-8.6);
  % Add background grid lines
  \begin{scope}[gray,semitransparent,semithick]
    \horlines{}
    \foreach \x in {1,...,10}
      \draw (\x,1) -- (\x,-2); %-12.8
    % similar: \vertlines{1,...,6}
  \end{scope}
  % Add labels
%   \node [anchor=south east,inner sep=0pt]
%     at (7,-8.45) {\tiny clocked};
%   \node [anchor=south east,inner sep=0pt,fgred]
%     at (7,-12.8) {\tiny positive edge triggered};
 \end{pgfonlayer}
\end{tikztimingtable}%

\end{center}

\caption{Timing of 8N1 USART Config.}
\end{figure}

For data transmission we use a USART configuration with 1 start-bit, 
8 data bits, 1 stop bit and no parity, as depicted in Figure 
\ref{fig:bus:design:layer1:usartconfig} \nameref{fig:bus:design:layer1:usartconfig}.
The physical layer as defined in our protocol has to support collision avoidance 
strategies of higher layers, and thus provide mechanisms for bit wise arbitration as described below.\\

To provide bit wise arbitration we need to access the bus 
in the startup-phase of sending a message in a modified software-USART.
After the bus is assigned to certain node the communication over the 
hardware supported USART can be established, since this decreases the processor load immensely.


\begin{figure}[h]
 \label{fig:bus:design:layer1:arbitration}
\begin{center}


\definecolor{bgblue}{rgb}{0.41961,0.80784,0.80784}%
\definecolor{bgred}{rgb}{1,0.61569,0.61569}%
\definecolor{fgblue}{rgb}{0,0,0.6}%
\definecolor{fgred}{rgb}{0.6,0,0}%
%
\begin{tikztimingtable}[
    %timing/slope=0,         % no slope
    timing/coldist=2pt,     % column distance
    timing/lslope=0.1,
    xscale=2.05,yscale=2., % scale diagrams
    semithick               % set line width
  ]
  \scriptsize node1  	& HLHHHLHHLHHLLLLH  \\
  \scriptsize node2     & HLHHHLHHLHHLHHHH  \\
  \scriptsize bus       & HLHHHLHHLHHLLLLH  \\
  %R                     & [fgblue]  UH .8U 1.4H 0.8L \\
  %MISO & D{z} 2D{z} \\
  %Q                     &          L .8H 1.7L 1.5H LL       \\
  %$\overline{\mbox{Q}}$ &          H .8L 1.7H 1.5L HH       \\
  %Q                     & [fgred]  HLHHHLL                  \\
  %$\overline{\mbox{Q}}$ & [fgred]  LHLLLHH                  \\
\extracode
 \makeatletter
  \begin{pgfonlayer}{background}
%   % Draw shaded backgrounds
%   \shade [right color=bgblue,left color=white]
%      (7,-8.45) rectangle (-2,-4.6);
%   \shade [right color=bgred,left color=white]
%      (7,-12.8) rectangle (-2,-8.6);
  % Add background grid lines
  \begin{scope}[gray,semitransparent,semithick]
    \horlines{}
    \foreach \x in {1,...,15}
      \draw (\x,1) -- (\x,-4); %-12.8
    % similar: \vertlines{1,...,6}
  \end{scope}
  % Add labels
   \node [anchor=south east,inner sep=0pt]
     at (14.5,-2.5) {\tiny collission detected};
%   \node [anchor=south east,inner sep=0pt,fgred]
%     at (7,-12.8) {\tiny positive edge triggered};
 \end{pgfonlayer}
\end{tikztimingtable}%

\end{center}
\caption{Collission avoidance via arbitration.}
\end{figure}

The arbitration as depicted in figure \ref{fig:bus:design:layer1:arbitration} \nameref{fig:bus:design:layer1:arbitration}
is realized via the software-USART driver. 
When a node decides to send a message it sends the Start of Frame, the MessageID, 
the ReceiverNodeID and the SenderNodeID bit wise on the bus and reads it back.\\

Since any other node deciding to send a message at the same instant in time, 
has to perform the same collision detection strategy the nodes with a weaker 
arbitration mask detect that the signal on the bus is not the signal driven by themselves.
A node detecting such a behavior has to switch in a reading state 
at a higher layer leading to only one node accessing the bus exclusively.\\

As briefly mentioned the switch of the arbitration mode to a reading 
mode has to be done on higher layers, it has also to be guaranteed 
by higher layers that during reading a message the node must not write data to the bus.
